from django.conf.urls import *

import autocomplete_light
autocomplete_light.autodiscover()

from django.contrib import admin
admin.autodiscover()

from mdcssport.mdcsapp.feeds import LatestNews, LatestMatches
 
feeds = {
    'news': LatestNews,
    'matches': LatestMatches
}

# django gotove stvari za auth
urlpatterns = patterns('',
    (r'^login/$', 'django.contrib.auth.views.login', {'template_name': 'login.html'}),
    (r'^logout/$', 'django.contrib.auth.views.logout', {'template_name': 'logout.html'})
)

urlpatterns += patterns('mdcssport.mdcsapp.views',
    (r'^$', 'index'),
    (r'^profile/$', 'profile'),
    (r'^profile/password_change/$', 'profile_password_change'),
    (r'^standings/$', 'standings_all'),
    (r'^standings/(?P<game_type>\w+)/$', 'standings'),
    (r'^timeline/(?P<game_type>\w+)/$', 'timeline'),
    (r'^recommended/$', 'recommended'),
    (r'^user/(?P<user_id>\d+)/$', 'user'),
    (r'^head2head/$','head2head'),
    (r'^head2head/(?P<game_type>\w+)/(?P<user1_id>\d+)/(?P<user2_id>\d+)/$','compare_users')
)

# matches
urlpatterns += patterns('mdcssport.mdcsapp.views_matches',
    (r'^matches/(?P<game_type>\w+)/$', 'matches'),
    (r'^match/(?P<match_id>\d+)/$', 'match'),
    (r'^match/(?P<match_id>\d+)/add_comment/$', 'match_addedit_comment'),
    (r'^match/(?P<match_id>\d+)/edit_comment/(?P<comment_id>\d+)/$', 'match_addedit_comment'),
    (r'^add_match/$', 'add_match'),
    (r'^match/undo/(?P<match_id>\d+)/$', 'undo_match'),
)

# sports
urlpatterns += patterns('mdcssport.mdcsapp.views',
    (r'^chess/$', 'chess'),
    (r'^table_football/$', 'tf'),
    (r'^football/$', 'football'),
    (r'^basketball/$', 'basket')
)

# statistics
urlpatterns += patterns('mdcssport.mdcsapp.views_stats',
    (r'^statistics/$', 'statistics'),
    (r'^statistics/chess/$', 'chess_statistics'),
    (r'^statistics/table_football/$', 'tf_statistics'),
    (r'^statistics/football/$', 'football_statistics'),
    (r'^statistics/basketball/$', 'basket_statistics')
)

# za vesti
urlpatterns += patterns('mdcssport.mdcsapp.views_news',
    (r'^news/$', 'news'),
    (r'^news/(?P<news_id>\d+)/$', 'one_news'),
    (r'^news/edit/$', 'news_edit'),
    (r'^news/edit/(?P<news_id>\d+)/$', 'news_edit')
)

# image generation
urlpatterns += patterns('mdcssport.mdcsapp.views_imagegen',
    (r'^statistics/(?P<game_type>\w+)/timeline.png$', 'statistics_timeline'),
    (r'^user/(?P<user_id>\d+)/points_timeline.png$', 'user_points_timeline'),
    (r'^head2head/(?P<game_type>\w+)/(?P<user_id1>\d+)/(?P<user_id2>\d+)/timeline.png$', 'head2head_timeline')
)

# about
urlpatterns += patterns('mdcssport.mdcsapp.views_about',
    (r'^about/$', 'about'),
    (r'^about/scoring/$', 'about_scoring'),
    (r'^about/recommended/$', 'recommended_about')
)

# feeds
from django.contrib.syndication.views import Feed

urlpatterns += patterns('',
    (r'^feeds/news/$', LatestNews()),
    (r'^feeds/matches/$', LatestMatches()),
)